package com.user.profile.service.user;

import com.user.profile.entity.UserEntity;
import com.user.profile.perm.ClickHousePerm;

import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;

/**
 * @Author linlx
 * @Date 2021/9/22 10:11
 * @Description
 **/
@Service
public class VipInsertBuildImpl implements InsertBuild {

  @Resource
  private CommonInsertBuild commonInsertBuild;

  @Override
  public List<String> build(List<UserEntity> dataList) {
    Map<String, List<UserEntity>> vipMap = dataList.stream()
        .collect(Collectors.groupingBy(UserEntity::getVipLevel));
    return commonInsertBuild.buildLabelString(vipMap, ClickHousePerm.INSERT_VIP);
  }
}
